package com.zmj.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ServiceProxy implements InvocationHandler {

    BaseService us;
    public ServiceProxy(BaseService us){
        this.us = us;
    }

    //指定被代理对象的方法
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        LogManager.start();

        //method:被代理对象的目标方法;
        Object result = method.invoke(us, args);

        LogManager.end();
        return result;
    }


}
